home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 033a / paswrd21.zip / PASSWORD.BAS next >
BASIC Source File  |  1991-04-21  |  36KB  |  769 lines

  1. '****************************************************************************
  2. '****************************************************************************
  3. '* PASSWORD.BAS by Duane Paulson. First released into the Public Domain on  *
  4. '* 4/23/91. Version 2.1 released 04/21/91.                                  *
  5. '* This version developed using Microsoft BASIC Professional Development    *
  6. '* System version 7.1. Also compatible with QuickBASIC version 4.5.         *
  7. '*                                                                          *
  8. '* PURPOSE: Generates a string of random characters, 5 to 8 characters long,*
  9. '* suitable for use as a password.                                          *
  10. '*                                                                          *
  11. '* INPUT: (1) Accepts single keystroke from user via radio button interface.*
  12. '*        (2) System timer provides random function seed.                   *
  13. '*        (3) BASIC random function provides random variables.              *
  14. '*                                                                          *
  15. '* OUTPUT: Random password string displayed to screen.                      *
  16. '*                                                                          *
  17. '* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX *
  18. '* COMPILE AND LINK INSTRUCTIONS for BASIC PDS 7.1:                         *
  19. '*                                                                          *
  20. '* bc /O /Ot /Lr /FPa /T /C:512 password;                                   *
  21. '* link /NOE password.obj+nofltin.obj+nolpt.obj+smallerr.obj+noedit.obj+nocom.obj,,,bcl71anr.lib;
  22. '*                                                                          *
  23. '* COMPILING UNDER QUICKBASIC 4.5                                           *
  24. '*                                                                          *
  25. '* Select the "Make EXE" option from the "Run" menu. The executable will be *
  26. '*  significantly larger than the one supplied with the distribution        *
  27. '*  package.                                                                *
  28. '****************************************************************************
  29. '****************************************************************************
  30.  
  31. DEFINT A-Z  ' Declare integer as default variable type.
  32.  
  33. '****************************************************************************
  34. '* SUBprocedure and FUNCTION procedure declarations.                        *
  35. '****************************************************************************
  36. DECLARE SUB A.ShowTime (Row, Col) ' Display the current time
  37. DECLARE SUB Title ()             ' Opening title
  38. DECLARE SUB SetUpDisplay ()      ' Initializes screen display
  39. DECLARE SUB PrintPassword ()     ' Prints the password to screen
  40. DECLARE SUB ClearBox ()          ' Clears the password display
  41. DECLARE SUB SelectPassword ()    ' Generates the password
  42. DECLARE FUNCTION AcceptKey ()    ' Processes user input
  43. DECLARE SUB ShowInfo ()          ' Displays information about program
  44.  
  45. '****************************************************************************
  46. '* Global constant and variable declarations.                               *
  47. '****************************************************************************
  48. CONST False% = 0, True% = NOT False
  49. DIM SHARED password AS STRING       ' The random string
  50. DIM SHARED LenFrame AS INTEGER      ' Length of password+2
  51. DIM SHARED StartColumn AS INTEGER   ' The column where the password display
  52.                                     '  will start.
  53.  
  54. '****************************************************************************
  55. '* Main Procedure processing begins here.                                   *
  56. '*                                                                          *
  57. '* PURPOSE: To control program flow                                         *
  58. '*                                                                          *
  59. '* INPUT: Current button from FUNCTION AcceptKey                            *
  60. '*                                                                          *
  61. '* OUTPUT: None                                                             *
  62. '*                                                                          *
  63. '* VARIABLES USED:                                                          *
  64. '*  AcceptKey        Indicates current button                               *
  65. '*  Finished         Exit flag                                              *
  66. '****************************************************************************
  67. RANDOMIZE TIMER                  ' Seed the random function
  68.  
  69. '****************************************************************************
  70. '* Initialize display and select first password                             *
  71. '****************************************************************************
  72. Title
  73. SetUpDisplay
  74. SelectPassword
  75.  
  76. '****************************************************************************
  77. '* Main Loop                                                                *
  78. '****************************************************************************
  79. DO WHILE NOT Finished
  80.    SELECT CASE AcceptKey
  81.       CASE 1
  82.          ClearBox
  83.          SelectPassword
  84.       CASE 2
  85.          Finished = True
  86.       CASE 3
  87.          ShowInfo
  88.          PrintPassword
  89.    END SELECT
  90. LOOP
  91.  
  92. '****************************************************************************
  93. '* Exit routine                                                             *
  94. '****************************************************************************
  95. LOCATE 25, 1
  96. END
  97.  
  98. '****************************************************************************
  99. '* End of Main Procedure                                                    *
  100. '****************************************************************************
  101.  
  102. '----------------------------------------------------------------------------
  103. '****************************************************************************
  104. '* SUB A.ShowTime                                                           *
  105. '*  PURPOSE: Displays the current time in am/pm format on the top line      *
  106. '*                                                                          *
  107. '*  INPUT: (1) From calling procedure: current cursor position              *
  108. '*         (2) From user: None                                              *
  109. '*         (3) From BIOS clock (if found) or System Timer: time of day      *
  110. '*                                                                          *
  111. '*  OUTPUT: (1) To calling procedure: None                                  *
  112. '*          (2) To user: Time of day in am/pm format in upper right corner  *
  113. '*                       of screen.                                         *
  114. '*                                                                          *
  115. '*  VARIABLES USED:                                                         *
  116. '*  tim$     Time of day input buffer.                                      *
  117. '*  Hr$,Hr   Hour of day as value, for processing of time display.          *
  118. '*  m$       A.M./P.M. string for time display.                             *
  119. '****************************************************************************
  120. '----------------------------------------------------------------------------
  121. SUB A.ShowTime (Row, Col)
  122.  
  123. '****************************************************************************
  124. '* Create variable containing current hour (for am/pm conversion)           *
  125. '****************************************************************************
  126. tim$ = TIME$
  127. Hr$ = LEFT$(tim$, 2)
  128. Hr = VAL(Hr$)
  129.  
  130. '****************************************************************************
  131. '* Convert to am/pm format                                                  *
  132. '****************************************************************************
  133. SELECT CASE Hr
  134.    CASE IS > 12                     ' P.M.
  135.       Hr = Hr - 12
  136.       Hr$ = LTRIM$(STR$(Hr))
  137.       m$ = "p.m."
  138.    CASE 0                           ' Midnight
  139.       m$ = "a.m."
  140.       Hr$ = "12"
  141.    CASE ELSE                        ' A.M.
  142.       Hr$ = LTRIM$(STR$(Hr))
  143.       m$ = "a.m."
  144. END SELECT
  145.  
  146. tim$ = Hr$ + RIGHT$(tim$, 6) + " " + m$      ' Finish the conversion
  147. IF LEN(tim$) = 12 THEN tim$ = " " + tim$     '  and adjust for length
  148.  
  149. '****************************************************************************
  150. '* Display the time                                                         *
  151. '****************************************************************************
  152. LOCATE 1, 68
  153. PRINT tim$;
  154. LOCATE Row, Col
  155.  
  156. END SUB
  157.  
  158. '----------------------------------------------------------------------------
  159. '****************************************************************************
  160. '* FUNCTION AcceptKey                                                       *
  161. '*                                                                          *
  162. '* PURPOSE: Processes user input                                            *
  163. '*                                                                          *
  164. '* INPUT: (1) From calling procedure: None.                                 *
  165. '*        (2) From user: Single keystroke.                                  *
  166. '*                                                                          *
  167. '* OUTPUT: (1) To calling procedure: AcceptKey                              *
  168. '*         (2) To user: Prompt strings, highlighting of radio buttons.      *
  169. '*                                                                          *
  170. '* LOCAL SUBROUTINES:                                                       *
  171. '*  AgainOn,AgainOff,ExitOn,ExitOff,InfoOn,InfoOff                          *
  172. '*                Turns on or off highlighting of radio buttons.            *
  173. '*                                                                          *
  174. '* VARIABLES USED:                                                          *
  175. '*  a$            Input buffer.                                             *
  176. '*  AcceptKey     Passes current back to main procedure.                    *
  177. '*  Button        Keeps track of current radio button. Must be STATIC.      *
  178. '*  Finished      Controlls processing loop.                                *
  179. '*  cp            Current cursor position. For finding current radio button *
  180. '*                      after displaying time.                              *
  181. '*  Esc$,Enter$,TabKey$,ShiftTab$,Spacebar$,LeftArrow$,RightArrow$          *
  182. '*                ASCII substitution strings.                               *
  183. '****************************************************************************
  184. '----------------------------------------------------------------------------
  185. FUNCTION AcceptKey STATIC
  186.  
  187. Esc$ = CHR$(27): Enter$ = CHR$(13): TabKey$ = CHR$(9)
  188. ShiftTab$ = CHR$(0) + CHR$(15): Spacebar$ = CHR$(32):
  189. LeftArrow$ = CHR$(0) + CHR$(75): RightArrow$ = CHR$(0) + CHR$(77)
  190.  
  191. IF Button = 0 THEN Button = 1 ' Initialize Button the first time this
  192.                               '   Function is called.
  193.  
  194. Finished = False  ' Reset exit flag
  195.  
  196.  
  197. '****************************************************************************
  198. '* Input processing loop.                                                   *
  199. '****************************************************************************
  200. DO WHILE Finished = False
  201.    SELECT CASE Button                  ' Determine current button and
  202.       CASE 1                           '  display the cursor in appropriate
  203.          LOCATE 16, 23, 1              '  location.
  204.       CASE 2
  205.          LOCATE 16, 38, 1
  206.       CASE 3
  207.          LOCATE 16, 53, 1
  208.    END SELECT
  209.  
  210.    A$ = ""                 ' Clear the input buffer.
  211.    COLOR 0, 7              ' Black on light gray.
  212.    cp = POS(0)             ' Store cursor position.
  213.  
  214. '****************************************************************************
  215. '* Accept keystroke from user.                                              *
  216. '****************************************************************************
  217.    DO WHILE A$ = ""
  218.       A$ = INKEY$
  219.          ' If tenths of second=0 then display the time on the top line.
  220.          ' Doing it this way cuts down on cursor flicker.
  221.       IF INT(TIMER * 10) MOD 10 = 0 THEN A.ShowTime 16, cp
  222.    LOOP
  223. '****************************************************************************
  224. '* End of keystoke capture loop.                                            *
  225. '****************************************************************************
  226.  
  227.    SELECT CASE A$                      ' Now that we have the keystroke,
  228.       CASE Esc$                        '  process it if it's an acceptable
  229.          AcceptKey = 2                 '  one. Shift radio buttons, show
  230.          Finished = True               '  info, or set exit flag, as
  231.                                        '  appropriate.
  232.  
  233.       CASE TabKey$, RightArrow$    ' Shift buttons right (or wrap around)
  234.          AcceptKey = Button
  235.          SELECT CASE Button
  236.             CASE 1
  237.                GOSUB AgainOff
  238.                GOSUB ExitOn
  239.                Button = 2
  240.             CASE 2
  241.                GOSUB ExitOff
  242.                GOSUB InfoOn
  243.                Button = 3
  244.             CASE 3
  245.                GOSUB InfoOff
  246.                GOSUB AgainOn
  247.                Button = 1
  248.          END SELECT
  249.  
  250.       CASE ShiftTab$, LeftArrow$    ' Shift buttons left (or wrap around)
  251.          AcceptKey = Button
  252.          SELECT CASE Button
  253.             CASE 1
  254.                GOSUB AgainOff
  255.                GOSUB InfoOn
  256.                Button = 3
  257.             CASE 2
  258.                GOSUB ExitOff
  259.                GOSUB AgainOn
  260.                Button = 1
  261.             CASE 3
  262.                GOSUB InfoOff
  263.                GOSUB ExitOn
  264.                Button = 2
  265.          END SELECT
  266.  
  267.       CASE Enter$, Spacebar$       ' Action key.
  268.          AcceptKey = Button
  269.          Finished = True
  270.    END SELECT
  271.  
  272. LOOP
  273. '****************************************************************************
  274. '* End of input processing loop.                                            *
  275. '****************************************************************************
  276.  
  277. LOCATE , , 0         ' Turn off cursor.
  278. EXIT FUNCTION        ' End of main part of function.
  279.  
  280. '****************************************************************************
  281. '* Local SUBROUTINES for Function AcceptKey                                 *
  282. '****************************************************************************
  283. AgainOff:
  284.    COLOR 0, 7
  285.    LOCATE 16, 22
  286.    PRINT "<";
  287.    LOCATE 16, 30
  288.    PRINT ">";
  289. RETURN
  290.  
  291. AgainOn:
  292.    COLOR 15, 7
  293.    LOCATE 16, 22
  294.    PRINT "<";
  295.    LOCATE 16, 30
  296.    PRINT ">";
  297.    COLOR 0, 3
  298.    LOCATE 24, 1
  299.    PRINT SPACE$(80);
  300.    LOCATE 24, 3
  301.    PRINT "Generate another password."
  302. RETURN
  303.  
  304. ExitOff:
  305.    COLOR 0, 7
  306.    LOCATE 16, 37
  307.    PRINT "<";
  308.    LOCATE 16, 44
  309.    PRINT ">";
  310. RETURN
  311.  
  312. ExitOn:
  313.    COLOR 15, 7
  314.    LOCATE 16, 37
  315.    PRINT "<";
  316.    LOCATE 16, 44
  317.    PRINT ">";
  318.    COLOR 0, 3
  319.    LOCATE 24, 1
  320.    PRINT SPACE$(80);
  321.    LOCATE 24, 3
  322.    PRINT "Exit to DOS."
  323. RETURN
  324.  
  325. InfoOff:
  326.    COLOR 0, 7
  327.    LOCATE 16, 52
  328.    PRINT "<";
  329.    LOCATE 16, 59
  330.    PRINT ">";
  331. RETURN
  332.  
  333. InfoOn:
  334.    COLOR 15, 7
  335.    LOCATE 16, 52
  336.    PRINT "<";
  337.    LOCATE 16, 59
  338.    PRINT ">";
  339.    COLOR 0, 3
  340.    LOCATE 24, 1
  341.    PRINT SPACE$(80);
  342.    LOCATE 24, 3
  343.    PRINT "Display information about program."
  344. RETURN
  345.  
  346. END FUNCTION
  347.  
  348. '----------------------------------------------------------------------------
  349. '****************************************************************************
  350. '* SUB ClearBox                                                             *
  351. '*                                                                          *
  352. '*  PURPOSE: Clears the display box that the password appears in.           *
  353. '*                                                                          *
  354. '*  INPUT: None                                                             *
  355. '*                                                                          *
  356. '*  OUTPUT: (1) To calling procedure: None                                  *
  357. '*          (2) To user: Spaces blank the old password display box.         *
  358. '*                                                                          *
  359. '*  VARIABLES USED:                                                         *
  360. '*    LenFrame       Length of password+2. This is the length of the top    *
  361. '*                   and bottom lines for the password display box. It does *
  362. '*                   not include the length of the corner characters,       *
  363. '*                   representing instead the number of straight line       *
  364. '*                   characters that will have to be drawn by               *
  365. '*                   SUB PrintPassword. Taking into account the corner      *
  366. '*                   characters and the two shadow characters, a total of   *
  367. '*                   4 spaces has to be added to blank the entire display.  *
  368. '*                   LenFrame is a global variable.                         *
  369. '****************************************************************************
  370. '----------------------------------------------------------------------------
  371. SUB ClearBox
  372.  
  373. IF LenFrame = 0 THEN EXIT SUB
  374.  
  375. COLOR 0, 7                    ' Black on light gray
  376. FOR A = 10 TO 14
  377.    LOCATE A, StartColumn
  378.    PRINT SPACE$(LenFrame + 4);
  379. NEXT A
  380.  
  381. END SUB
  382.  
  383. '----------------------------------------------------------------------------
  384. '****************************************************************************
  385. '* SUB PrintPassword                                                        *
  386. '*                                                                          *
  387. '*  PURPOSE: Print the password string to the screen.                       *
  388. '*                                                                          *
  389. '*  INPUT: Global variables Password, LenPassword, StartColumn.             *
  390. '*                                                                          *
  391. '*  OUTPUT: Password string displayed to screen.                            *
  392. '*                                                                          *
  393. '*  VARIABLES USED: [No local variables]                                    *
  394. '*                                                                          *
  395. '****************************************************************************
  396. '----------------------------------------------------------------------------
  397. SUB PrintPassword
  398. '****************************************************************************
  399. '* Calculate the length of the 'frame' and center the display.              *
  400. '****************************************************************************
  401.  
  402. COLOR 7, 4              ' Light gray on red.
  403. LOCATE 10, StartColumn - length
  404. PRINT "╔"; STRING$(LenFrame, "═"); "╗"   ' Top of frame"
  405.  
  406.  
  407. '****************************************************************************
  408. '* Print the password.                                                      *
  409. '****************************************************************************
  410. LOCATE 11, StartColumn - length
  411. COLOR 7, 4: PRINT "║ "; : COLOR 15, 4: PRINT password; : COLOR 7, 4: PRINT " ║";
  412. COLOR 7, 0: PRINT SPACE$(2)   ' Print 2 "shadow" characters.
  413.  
  414. LOCATE 12, StartColumn - length
  415. COLOR 7, 4: PRINT "╚"; STRING$(LenFrame, "═"); "╝";   ' Bottom of frame
  416. COLOR 7, 0: PRINT SPACE$(2)         ' 2 "shadow" characters
  417.  
  418. LOCATE 13, StartColumn + 2 - length          ' bottom "shadow" characters
  419. PRINT SPACE$(LenFrame + 2)
  420.  
  421. END SUB
  422.  
  423. '----------------------------------------------------------------------------
  424. '****************************************************************************
  425. '* SUB SelectPassword                                                       *
  426. '*                                                                          *
  427. '*  PURPOSE: Generate a 5 to 8 character long random string.                *
  428. '*                                                                          *
  429. '*  INPUT: None                                                             *
  430. '*                                                                          *
  431. '*  OUTPUT: Global variables Password, LenFrame, Startcol.                  *
  432. '*                                                                          *
  433. '*  VARIABLES USED:                                                         *
  434. '*    length         Length of password                                     *
  435. '*    char, char$    Buffer to hold each individual character as it is      *
  436. '*                      generated.                                          *
  437. '****************************************************************************
  438. '----------------------------------------------------------------------------
  439. SUB SelectPassword
  440.  
  441. '****************************************************************************
  442. '* Initialize string variable                                               *
  443. '****************************************************************************
  444. password = ""
  445.  
  446. '****************************************************************************
  447. '* Select random password length between 5 and 8 characters using the       *
  448. '* following formula:                                                       *
  449. '* INT ((upperbound - lowerbound + 1)*RND + lowerbound)                     *
  450. '****************************************************************************
  451. length = INT((8 - 5 + 1) * RND + 5)
  452.  
  453. '****************************************************************************
  454. '* Fill in each character using 0-9 and a-z (total of 36 characters)        *
  455. '****************************************************************************
  456.   FOR A = 1 TO length
  457.     char = INT((35 - 0 + 1) * RND + 0)
  458.  
  459. '****************************************************************************
  460. '* Convert to ASCII character                                               *
  461. '*    Values 0-9 become "0"-"9"                                             *
  462. '*    Values 10-35 become "A"-"Z"                                           *
  463. '****************************************************************************
  464.     IF char < 10 THEN
  465.         char$ = CHR$(char + ASC("0"))
  466.     ELSE
  467.         char$ = CHR$(char - 10 + ASC("a"))
  468.     END IF
  469.  
  470. '****************************************************************************
  471. '* Add to end of the string and pad with a space to make reading easier.    *
  472. '****************************************************************************
  473.     password = password + char$ + " "
  474.  
  475.   NEXT A
  476.  
  477. '****************************************************************************
  478. '* Remove the final space                                                   *
  479. '****************************************************************************
  480.  
  481. password = LEFT$(password, LEN(password) - 1)
  482.  
  483. LenFrame = LEN(password) + 2
  484. StartColumn = 40 - ((LenFrame \ 2) + (LenFrame MOD 2))
  485.  
  486. PrintPassword
  487.  
  488. END SUB
  489.  
  490. '----------------------------------------------------------------------------
  491. '****************************************************************************
  492. '* SUB SetUpDisplay                                                         *
  493. '*                                                                          *
  494. '*  PURPOSE: Initialize or restore the screen display.                      *
  495. '*                                                                          *
  496. '*  INPUT: None                                                             *
  497. '*                                                                          *
  498. '*  OUTPUT: Background display to screen.                                   *
  499. '*                                                                          *
  500. '*  VARIABLES USED: None.                                                   *
  501. '****************************************************************************
  502. '----------------------------------------------------------------------------
  503. SUB SetUpDisplay
  504.  
  505. '****************************************************************************
  506. '* Display active keys for main process                                     *
  507. '****************************************************************************
  508. COLOR 0, 7                    ' Black on light gray
  509. LOCATE 25, 1
  510. PRINT SPACE$(80);             ' Clear and print active keys line.
  511. LOCATE 25, 3
  512. PRINT "Move with <Tab>, <Shift+Tab>, <-, ->.   Select with <Enter>, <Spacebar>.";
  513.  
  514. '****************************************************************************
  515. '* Draw main display "box" in center of screen.                             *
  516. '****************************************************************************
  517. LOCATE 7, 20                        ' Draw main display box
  518. PRINT "╔"; STRING$(40, "═"); "╗"    ' Top of box
  519.  
  520. FOR A = 8 TO 14                  ' Body of box
  521.    LOCATE A, 20
  522.    PRINT "║"; SPACE$(40); "║";
  523.    COLOR 1, 0                    ' Blue on black
  524.    PRINT SPACE$(2)               '  Draw "shadow"
  525.    COLOR 0, 7                    ' Black on light gray
  526. NEXT A
  527.  
  528. COLOR 0, 7
  529. LOCATE 15, 20
  530. PRINT "╟"; STRING$(40, "─"); "╢";   ' Line for Button "window"
  531. COLOR 1, 0                             ' Blue on black
  532. PRINT SPACE$(2)                        '  Draw "shadow"
  533.  
  534. COLOR 0, 7                          ' Black on light gray
  535. LOCATE 17, 20                       '  Bottom of main display box.
  536. PRINT "╚"; STRING$(40, "═"); "╝";
  537. COLOR 1, 0                          ' Blue on black
  538. PRINT SPACE$(2)                     '  shadow
  539. LOCATE 18, 22
  540. PRINT SPACE$(42)
  541.  
  542. '****************************************************************************
  543. '* Display permanent text for the box                                       *
  544. '****************************************************************************
  545. COLOR 0, 7                          ' Black on light gray
  546. LOCATE 8, 28
  547. PRINT "Here Is Your New Password"
  548.  
  549. '****************************************************************************
  550. '* Display the three "radio buttons"                                        *
  551. '****************************************************************************
  552. LOCATE 16, 20
  553. PRINT "║ ";
  554. COLOR 15, 7                         ' White on light gray
  555. PRINT "<";                          ' Highlighted angle bracket
  556. COLOR 0, 7                          ' Black on light gray
  557. PRINT " Again ";                    ' Text of default button
  558. COLOR 15, 7                         ' White on light gray
  559. PRINT ">";                          ' Highlighted angle bracket
  560.  
  561. COLOR 0, 7                                      ' Black on light gray
  562. PRINT SPACE$(6); "< Exit >       < Info > ║";   ' Non-selected buttons don't
  563.                                                 '  have highlighted brackets
  564. COLOR 1, 0                 ' Blue on black
  565. PRINT SPACE$(2)            '  "shadow" for button line.
  566.  
  567.  
  568. END SUB
  569.  
  570. '----------------------------------------------------------------------------
  571. '****************************************************************************
  572. '* SUB ShowInfo                                                             *
  573. '*                                                                          *
  574. '*  PURPOSE: Display information about program to screen.                   *
  575. '*                                                                          *
  576. '*  INPUT: None.                                                            *
  577. '*                                                                          *
  578. '*  OUTPUT: Informational display to screen.                                *
  579. '*                                                                          *
  580. '*  VARIABLES USED: None.                                                   *
  581. '****************************************************************************
  582. '----------------------------------------------------------------------------
  583. SUB ShowInfo
  584.  
  585. '****************************************************************************
  586. '* Display the information                                                  *
  587. '****************************************************************************
  588. COLOR 15, 5       ' White on magenta
  589. LOCATE 5, 1
  590.  
  591. PRINT "╔"; STRING$(78, "═"); "╗"
  592. PRINT "║PASSWORD is a public domain program. It generates a random alphanumeric string║"
  593. PRINT "║between 5 and 8 characters long suitable for use as a password. It only uses  ║"
  594. PRINT "║the characters 0-9 and a-z, in order to maintain compatibility with a wide    ║"
  595. PRINT "║range of systems. If a system requires a delimiting character, feel free to   ║"
  596. PRINT "║drop one in somewhere. Working with a 5 to 8 character string using 0-9 and   ║"
  597. PRINT "║a-z (36 characters) gives an extremely large total of possible combinations:  ║"
  598. PRINT "║(36^5)+(36^6)+(36^7)+(36^8), or 3,901,711,320,064. Over 3 billion passwords.  ║"
  599. PRINT "║That's enough to keep anyone guessing for a while.                            ║"
  600. PRINT "║                                                                              ║"
  601. PRINT "║Experts say that you should choose a password that has no relationship to     ║"
  602. PRINT "║anything in your life, so what better than a random generator to pick your    ║"
  603. PRINT "║passwords for you? Just remember, the more meaningless the password is        ║"
  604. PRINT "║the better for you. Remember: Be safe, change your password often.            ║"
  605. PRINT "╟"; STRING$(78, "─"); "╢";
  606. PRINT "║                                   "; : COLOR 14, 5: PRINT "<";
  607. COLOR 15, 5: PRINT " OK "; : COLOR 14, 5: PRINT ">"; : COLOR 15, 5
  608. PRINT "                                     ║"
  609. PRINT "╚"; STRING$(78, "═"); "╝";
  610.  
  611. COLOR 1, 0           ' Blue on black
  612. LOCATE 22, 3
  613. PRINT SPACE$(78);    ' "shadow"
  614.  
  615. '****************************************************************************
  616. '* User prompt line                                                         *
  617. '****************************************************************************
  618. LOCATE 20, 38, 1
  619.  
  620. COLOR 0, 3        ' Black on cyan
  621. LOCATE 24, 1
  622. PRINT SPACE$(80);
  623. LOCATE 24, 3
  624. PRINT "Press a key to continue."
  625.  
  626. COLOR 0, 7     ' Black on light gray
  627. LOCATE 25, 1
  628. PRINT SPACE$(80);
  629.  
  630. LOCATE 20, 38, 1
  631.  
  632. '****************************************************************************
  633. '* Wait for a keystroke                                                     *
  634. '****************************************************************************
  635. DO
  636.    COLOR 0, 7
  637.    IF INT(TIMER * 10) MOD 10 = 0 THEN A.ShowTime 20, 38
  638. LOOP WHILE INKEY$ = ""
  639.  
  640. '****************************************************************************
  641. '* Restore main screen and return                                           *
  642. '****************************************************************************
  643. COLOR 0, 1           ' Black on blue
  644. VIEW PRINT 2 TO 23   ' Restore background
  645. CLS
  646.  
  647. VIEW PRINT
  648.  
  649. LOCATE 25, 1
  650. PRINT SPACE$(80);
  651.  
  652. SetUpDisplay
  653.  
  654. COLOR 0, 7              ' Fix the bracket highlights for the buttons to
  655. LOCATE 16, 22           '  show "info" button as active.
  656. PRINT "<";
  657. LOCATE 16, 30
  658. PRINT ">";
  659. COLOR 15, 7
  660. LOCATE 16, 52
  661. PRINT "<";
  662. LOCATE 16, 59
  663. PRINT ">";
  664. COLOR 0, 3
  665. LOCATE 24, 1
  666. PRINT SPACE$(80);
  667. LOCATE 24, 3
  668. PRINT "Display information about program.";  ' Fix user prompt
  669.  
  670. END SUB
  671.  
  672. '----------------------------------------------------------------------------
  673. '****************************************************************************
  674. '* SUB Title                                                                *
  675. '*                                                                          *
  676. '*  PURPOSE: Display opening screen.                                        *
  677. '*                                                                          *
  678. '*  INPUT: None.                                                            *
  679. '*                                                                          *
  680. '*  OUTPUT: Opening screen.                                                 *
  681. '*                                                                          *
  682. '*  VARIABLES USED:  tim&     Long integer to hold system timer value.      *
  683. '****************************************************************************
  684. '----------------------------------------------------------------------------
  685. SUB Title
  686.  
  687. '****************************************************************************
  688. '* Set background color.                                                    *
  689. '****************************************************************************
  690. COLOR 0, 1                       ' Black on blue
  691. CLS                              '  clear to blue background.
  692.  
  693. '****************************************************************************
  694. '* Display title bar on screen line 1                                       *
  695. '****************************************************************************
  696. COLOR 0, 7                       ' Black on light gray
  697. LOCATE 1, 1                      '  Title bar across top of screen.
  698. PRINT SPACE$(80);
  699. LOCATE 25, 1
  700. PRINT SPACE$(80);
  701. LOCATE 1, 1
  702. PRINT "PASSWORD version 2.1;"
  703.  
  704. '****************************************************************************
  705. '* Display "active key" list on line 25                                     *
  706. '****************************************************************************
  707. LOCATE 25, 1                     '  Acitve key list on line 25
  708. PRINT SPACE$(80);
  709.  
  710. '****************************************************************************
  711. '* Display user prompt on line 25                                           *
  712. '****************************************************************************
  713. COLOR 0, 3                       ' Black on cyan
  714. LOCATE 24, 1                     '  Prompt bar on line 24
  715. PRINT SPACE$(80);
  716. LOCATE 24, 3
  717. PRINT "Press a key to continue.";
  718.  
  719. '****************************************************************************
  720. '* Opening screen                                                           *
  721. '****************************************************************************
  722. LOCATE 8, 17                        ' Opening screen display.
  723. PRINT "╔"; STRING$(47, "═"); "╗"
  724. LOCATE 9, 17
  725. PRINT "║     PASSWORD version 2.1, by Duane Paulson    ║";
  726. COLOR 1, 0
  727. PRINT SPACE$(2)
  728. COLOR 0, 3
  729. LOCATE 10, 17
  730. PRINT "║ Portions (C) 1982-1990 Microsoft Corporation. ║";
  731. COLOR 1, 0
  732. PRINT SPACE$(2)
  733. COLOR 0, 3
  734. LOCATE 11, 17
  735. PRINT "║               All rights reserved.            ║";
  736. COLOR 1, 0
  737. PRINT SPACE$(2)
  738. COLOR 0, 3
  739. LOCATE 12, 17
  740. PRINT "╚"; STRING$(47, "═"); "╝";
  741. COLOR 1, 0
  742. PRINT SPACE$(2)
  743. LOCATE 13, 19
  744. PRINT SPACE$(49)
  745.  
  746. '****************************************************************************
  747. '* Wait for time delay or key hit                                           *
  748. '****************************************************************************
  749. tim& = TIMER + 5                             ' Wait for 5 seconds or keypress
  750. DO: LOOP WHILE TIMER < tim& AND INKEY$ = ""
  751.  
  752. '****************************************************************************
  753. '* Clear opening display                                                    *
  754. '****************************************************************************
  755. VIEW PRINT 2 TO 23         ' Clear middle portion of screen to blue background
  756. COLOR 0, 1                 ' Black on blue
  757. CLS
  758. VIEW PRINT
  759.  
  760. '****************************************************************************
  761. '* Display first user prompt of main program                                *
  762. '****************************************************************************
  763. COLOR 0, 3                             ' Black on cyan
  764. LOCATE 24, 3                           '  Display opening prompt string.
  765. PRINT "Generate another password.";
  766.  
  767. END SUB
  768.  
  769.